import Http from "../../utils/HttpUtil";
import URL from "../URL";
export default{
    //我的发布列表
    async  ShopShopManagement(userId,page=1){
        let url=URL.GetURL(URL.ShopShopManagement);
        return await(Http.Get(url+`?userId=${userId}&page=${page}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //我的交易列表
    //usertype(0买家 1卖家),orderType(0二手 1租赁)
    //orderStatus(订单状态 0 待支付 1已支付待发货 2已发货 3派验机 4已收货 5已取消)
    async ShopSelectShopOrder(usertype,orderType,orderStatus,userId){
        let url=URL.GetURL(URL.ShopSelectShopOrder);
        return await(Http.Get(url+`?userId=${userId}&usertype=${usertype}&orderType=${orderType}&orderStatus=${orderStatus}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //派优品下单
    async ShopFlySuperiorOrder(flySuperiorId,userId,payPwd){
        let url=URL.GetURL(URL.ShopFlySuperiorOrder);
        return await(Http.Get(url+`?userId=${userId}&flySuperiorId=${flySuperiorId}&payPwd=${payPwd}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //二手下单
    async ShopSecondHandOrderPay(SecondHandOrderId,userId,payPassword){
        let url=URL.GetURL(URL.ShopSecondHandOrderPay);
        let para={
            SecondHandOrderId,userId,payPassword
        };
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //提交二手订单
    async ShopSecondHandOrder(
        userId,
        sellerUserId,
        shopId,
        shopType,
        orderRemark,
        name,
        phone,
        address,
        flyTestAircraft,
        testAircraftPrice,
        cashDeposit,
        shopMoney,
        coupon
    ){
        let url=URL.GetURL(URL.ShopSecondHandOrder);
        let para={
            userId,
            sellerUserId,
            shopId,
            shopType,
            orderRemark,
            name,
            phone,
            address,
            flyTestAircraft,
            testAircraftPrice,
            cashDeposit,
            shopMoney,
            coupon
        };
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
    
}